package cn.ad.server.web.spring.service.actions.context;

import cn.ad.server.web.utils.JsonUtils;

import java.util.List;

/**
 * @author dongbin.yu
 * @from 2016-07-27
 * @reference http://gitlab.falcon.ly/data/document/wikis/bidrequest#_msocom_1
 * @since V1.0
 */
public class BidContext implements Cloneable {

	private long requestTimestamp;

	private String serverId;

	private int adxType;

	/**
	 * 接入渠道标识
	 */
	private String channel;

	private String bidId;

	private String bidVersion;

	private String feeType;

	private double bidFloor;

	private String priceUnit;

	private int transactionType;

	private String appId;

	private String appName;

	private String appType;

	private String appDomain;

	private String appVersion;

	private String appBundle;

	private String appStoreUrl;

	private String appKeywords;

	private int appIsPay;

	private int adFormat;

	private String includeAdvertiser;

	private String adxTagId;

	private String excludeIndustryCategory;

	private String excludeAdvertiserDomain;

	private String adspaceWidth;

	private String adspaceHeight;

	private String screenPosition;

	private String excludeCreativeType;

	private String includeMimes;

	private String adxSpaceId;

	private String adspaceSize;

	private int minDuration;

	private int maxDuration;

	private int dnt;

	private String ua;

	private String ip;

	private String imei;

	private String mac;

	private String mac1;

	private String idfa;

	private String aaid;

	private String anid;

	private String udid;

	private String duid;

	private String imeisha1;

	private String dpidsha1;

	private String macsha1;

	private String imeimd5;

	private String dpidmd5;

	private String macmd5;

	private String openUdid;

	private String customId;

	private String visitorId;

	private int muniqueType;

	private String muniqueId;

	private int mobOps;

	private String brand;

	private String modal;

	private int os;

	private String osVersion;

	private int jsEnable;

	private int connType;

	private int deviceType;

	private float screenDensity;

	private int screenWidth;

	private int screenHeight;

	private int screenOritent;

	private float latitude;

	private float longitude;

	private int countryId;

	private int stateId;

	private int cityId;

	private int districtId;

	private String browser;

	private String topRefUrl;

	private String refUrl;

	private String userId;

	private int gender;

	private int ageLow;

	private int ageHigh;

	private String interesting;

	private String language;

	private String impId;

	private int campaignId;

	private long strategyId;

	private long creativeId;

	private int templateId;

	private long materialId;

	private double bidPrice;

	private String bidPriceType;

	private String strategies;

	private int flag;

	private String guid;

	// 广点通的规格
	private int creativeSpec;

	// 广点通的规格(全部) adx_creative_spec
	private List<Integer> adxCreativeSpecs;

	// 广点通的地域码
	private int areaCode;

	/**
	 * 备用的Os。 取自ad_space表中os字段。
	 */
	private int secondOs;

	private boolean debugMode;

	// 广点通的user dmp id
	private List<Integer> userDmpId;
	
	// 百度 user标签
	private List<Long> customizedUserTags;

	/**
	 * 原始请求对象
	 */
	private Object originImpression;
	
	/**
	 * baidu
		// App允许的交互类型定义
        // 电话、下载、应用唤醒
	 */
	private String appInteractionType;
	/**
	 * // App开发者ID
	 */
	private String appPublisherId;
	/**
	 * // 用户分类
	 */
	private List<Long> userCategory;
	/**
	 * // flash版本
	 */
	private String flashVersion;
	
	/**
	 * // 网站分类
	 */
	private int siteCategory;
	/**
	 * // 网站质量类型
	 */
	private int siteQuality;
	/**
	 * // 页面类型
	 */
	private int pageType;
	/**
	 * 页面关键词
	 */
	private List<String> pageKeyword;
	/**
	 * 页面内容质量
	 */
	private int pageQuality;
	/**
	 * 页面分类
	 */
	private int pageVertical;
	
	/**
	 *视频的标题
	 */
	private String videoTitle;
	
	/**
	 * 视频的标签
	 */
	private List<String> videoTags;
	
	/**
	 * 视频的播放时长
	 */
	private int videoContentLength;
	/**
	 * //频道信息
	 */
	private List<Long> videoChannelId;
	/**
	 * //发布商允许的创意类型
	 */
	private List<Integer> IncludeCreativeType;
	
	/**
	 * 请求中的广告形式。
	 */
	private int adReqFormat;
	
	
	public int getAdReqFormat() {
		return adReqFormat;
	}

	public void setAdReqFormat(int adReqFormat) {
		this.adReqFormat = adReqFormat;
	}

	public List<Integer> getIncludeCreativeType() {
		return IncludeCreativeType;
	}

	public void setIncludeCreativeType(List<Integer> includeCreativeType) {
		IncludeCreativeType = includeCreativeType;
	}

	public String getVideoTitle() {
		return videoTitle;
	}

	public void setVideoTitle(String videoTitle) {
		this.videoTitle = videoTitle;
	}

	public List<String> getVideoTags() {
		return videoTags;
	}

	public void setVideoTags(List<String> videoTags) {
		this.videoTags = videoTags;
	}

	public int getVideoContentLength() {
		return videoContentLength;
	}

	public void setVideoContentLength(int videoContentLength) {
		this.videoContentLength = videoContentLength;
	}

	public List<Long> getVideoChannelId() {
		return videoChannelId;
	}

	public void setVideoChannelId(List<Long> videoChannelId) {
		this.videoChannelId = videoChannelId;
	}

	public int getSiteCategory() {
		return siteCategory;
	}

	public void setSiteCategory(int siteCategory) {
		this.siteCategory = siteCategory;
	}

	public int getSiteQuality() {
		return siteQuality;
	}

	public void setSiteQuality(int siteQuality) {
		this.siteQuality = siteQuality;
	}

	public int getPageType() {
		return pageType;
	}

	public void setPageType(int pageType) {
		this.pageType = pageType;
	}

	public List<String> getPageKeyword() {
		return pageKeyword;
	}

	public void setPageKeyword(List<String> pageKeyword) {
		this.pageKeyword = pageKeyword;
	}

	public int getPageQuality() {
		return pageQuality;
	}

	public void setPageQuality(int pageQuality) {
		this.pageQuality = pageQuality;
	}

	public int getPageVertical() {
		return pageVertical;
	}

	public void setPageVertical(int pageVertical) {
		this.pageVertical = pageVertical;
	}

	public String getFlashVersion() {
		return flashVersion;
	}

	public void setFlashVersion(String flashVersion) {
		this.flashVersion = flashVersion;
	}

	public List<Long> getUserCategory() {
		return userCategory;
	}

	public void setUserCategory(List<Long> userCategory) {
		this.userCategory = userCategory;
	}

	public String getAppInteractionType() {
		return appInteractionType;
	}

	public void setAppInteractionType(String appInteractionType) {
		this.appInteractionType = appInteractionType;
	}

	public String getAppPublisherId() {
		return appPublisherId;
	}

	public void setAppPublisherId(String appPublisherId) {
		this.appPublisherId = appPublisherId;
	}

	public List<Long> getCustomizedUserTags() {
		return customizedUserTags;
	}
	
	public void setCustomizedUserTags(List<Long> customizedUserTags) {
		this.customizedUserTags = customizedUserTags;
	}

	public Object getOriginImpression() {
		return originImpression;
	}

	public void setOriginImpression(Object originImpression) {
		this.originImpression = originImpression;
	}

	public List<Integer> getAdxCreativeSpecs() {
		return adxCreativeSpecs;
	}

	public void setAdxCreativeSpecs(List<Integer> adxCreativeSpecs) {
		this.adxCreativeSpecs = adxCreativeSpecs;
	}

	/**
	 * 获取gdt请求中： 广点通的规格(全部)的String格式
	 * 
	 * @return
	 */
	public String getAdxCreativeSpecsStr() {
		if (adxCreativeSpecs != null && adxCreativeSpecs.size() > 0) {
			StringBuilder builder = new StringBuilder();
			for (int i = 0; i < adxCreativeSpecs.size(); i++) {
				Integer val = adxCreativeSpecs.get(i);
				builder.append(val);
				if (adxCreativeSpecs.size() != (i + 1)) {
					builder.append(",");
				}
			}
			return builder.toString();
		}
		return "";
	}

	public List<Integer> getUserDmpId() {
		return userDmpId;
	}

	public void setUserDmpId(List<Integer> userDmpId) {
		this.userDmpId = userDmpId;
	}

	/**
	 * 获取gdt请求中： 用户 ID 命中的 DMP DMP人群包 ID
	 * 
	 * @return
	 */
	public String getAudienceId() {
		if (userDmpId != null && userDmpId.size() > 0) {
			StringBuilder builder = new StringBuilder();
			for (int i = 0; i < userDmpId.size(); i++) {
				Integer val = userDmpId.get(i);
				builder.append(val);
				if (userDmpId.size() != (i + 1)) {
					builder.append(",");
				}
			}
			return builder.toString();
		}
		return "";
	}

	public int getSecondOs() {
		return secondOs;
	}

	public void setSecondOs(int secondOs) {
		this.secondOs = secondOs;
	}

	public boolean isDebugMode() {
		return debugMode;
	}

	public void setDebugMode(boolean debugMode) {
		this.debugMode = debugMode;
	}

	public String getGuid() {
		return guid;
	}

	public void setGuid(String guid) {
		this.guid = guid;
	}

	public long getRequestTimestamp() {
		return requestTimestamp;
	}

	public void setRequestTimestamp(long requestTimestamp) {
		this.requestTimestamp = requestTimestamp;
	}

	public String getServerId() {
		return serverId;
	}

	public void setServerId(String serverId) {
		this.serverId = serverId;
	}

	public int getAdxType() {
		return adxType;
	}

	public void setAdxType(int adxType) {
		this.adxType = adxType;
	}

	public String getBidId() {
		return bidId;
	}

	public void setBidId(String bidId) {
		this.bidId = bidId;
	}

	public String getBidVersion() {
		return bidVersion;
	}

	public void setBidVersion(String bidVersion) {
		this.bidVersion = bidVersion;
	}

	public String getFeeType() {
		return feeType;
	}

	public void setFeeType(String feeType) {
		this.feeType = feeType;
	}

	public double getBidFloor() {
		return bidFloor;
	}

	public void setBidFloor(double bidFloor) {
		this.bidFloor = bidFloor;
	}

	public String getPriceUnit() {
		return priceUnit;
	}

	public void setPriceUnit(String priceUnit) {
		this.priceUnit = priceUnit;
	}

	public int getTransactionType() {
		return transactionType;
	}

	public void setTransactionType(int transactionType) {
		this.transactionType = transactionType;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getAppName() {
		return appName;
	}

	public void setAppName(String appName) {
		this.appName = appName;
	}

	public String getAppType() {
		return appType;
	}

	public void setAppType(String appType) {
		this.appType = appType;
	}

	public String getAppDomain() {
		return appDomain;
	}

	public void setAppDomain(String appDomain) {
		this.appDomain = appDomain;
	}

	public String getAppVersion() {
		return appVersion;
	}

	public void setAppVersion(String appVersion) {
		this.appVersion = appVersion;
	}

	public String getAppBundle() {
		return appBundle;
	}

	public void setAppBundle(String appBundle) {
		this.appBundle = appBundle;
	}

	public String getAppStoreUrl() {
		return appStoreUrl;
	}

	public void setAppStoreUrl(String appStoreUrl) {
		this.appStoreUrl = appStoreUrl;
	}

	public String getAppKeywords() {
		return appKeywords;
	}

	public void setAppKeywords(String appKeywords) {
		this.appKeywords = appKeywords;
	}

	public int getAppIsPay() {
		return appIsPay;
	}

	public void setAppIsPay(int appIsPay) {
		this.appIsPay = appIsPay;
	}

	public int getAdFormat() {
		return adFormat;
	}

	public void setAdFormat(int adFormat) {
		this.adFormat = adFormat;
	}

	public String getIncludeAdvertiser() {
		return includeAdvertiser;
	}

	public void setIncludeAdvertiser(String includeAdvertiser) {
		this.includeAdvertiser = includeAdvertiser;
	}

	public String getAdxTagId() {
		return adxTagId;
	}

	public void setAdxTagId(String adxTagId) {
		this.adxTagId = adxTagId;
	}

	public String getExcludeIndustryCategory() {
		return excludeIndustryCategory;
	}

	public void setExcludeIndustryCategory(String excludeIndustryCategory) {
		this.excludeIndustryCategory = excludeIndustryCategory;
	}

	public String getExcludeAdvertiserDomain() {
		return excludeAdvertiserDomain;
	}

	public void setExcludeAdvertiserDomain(String excludeAdvertiserDomain) {
		this.excludeAdvertiserDomain = excludeAdvertiserDomain;
	}

	public String getAdspaceWidth() {
		return adspaceWidth;
	}

	public void setAdspaceWidth(String adspaceWidth) {
		this.adspaceWidth = adspaceWidth;
	}

	public String getAdspaceHeight() {
		return adspaceHeight;
	}

	public void setAdspaceHeight(String adspaceHeight) {
		this.adspaceHeight = adspaceHeight;
	}

	public String getScreenPosition() {
		return screenPosition;
	}

	public void setScreenPosition(String screenPosition) {
		this.screenPosition = screenPosition;
	}

	public String getExcludeCreativeType() {
		return excludeCreativeType;
	}

	public void setExcludeCreativeType(String excludeCreativeType) {
		this.excludeCreativeType = excludeCreativeType;
	}

	public String getIncludeMimes() {
		return includeMimes;
	}

	public void setIncludeMimes(String includeMimes) {
		this.includeMimes = includeMimes;
	}

	public String getAdxSpaceId() {
		return adxSpaceId;
	}

	public void setAdxSpaceId(String adxSpaceId) {
		this.adxSpaceId = adxSpaceId;
	}

	public String getAdspaceSize() {
		return adspaceSize;
	}

	public void setAdspaceSize(String adspaceSize) {
		this.adspaceSize = adspaceSize;
	}

	public int getMinDuration() {
		return minDuration;
	}

	public void setMinDuration(int minDuration) {
		this.minDuration = minDuration;
	}

	public int getMaxDuration() {
		return maxDuration;
	}

	public void setMaxDuration(int maxDuration) {
		this.maxDuration = maxDuration;
	}

	public int getDnt() {
		return dnt;
	}

	public void setDnt(int dnt) {
		this.dnt = dnt;
	}

	public String getUa() {
		return ua;
	}

	public void setUa(String ua) {
		this.ua = ua;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getImei() {
		return imei;
	}

	public void setImei(String imei) {
		this.imei = imei;
	}

	public String getMac() {
		return mac;
	}

	public void setMac(String mac) {
		this.mac = mac;
	}

	public String getMac1() {
		return mac1;
	}

	public void setMac1(String mac1) {
		this.mac1 = mac1;
	}

	public String getIdfa() {
		return idfa;
	}

	public void setIdfa(String idfa) {
		this.idfa = idfa;
	}

	public String getAaid() {
		return aaid;
	}

	public void setAaid(String aaid) {
		this.aaid = aaid;
	}

	public String getAnid() {
		return anid;
	}

	public void setAnid(String anid) {
		this.anid = anid;
	}

	public String getUdid() {
		return udid;
	}

	public void setUdid(String udid) {
		this.udid = udid;
	}

	public String getDuid() {
		return duid;
	}

	public void setDuid(String duid) {
		this.duid = duid;
	}

	public String getImeisha1() {
		return imeisha1;
	}

	public void setImeisha1(String imeisha1) {
		this.imeisha1 = imeisha1;
	}

	public String getDpidsha1() {
		return dpidsha1;
	}

	public void setDpidsha1(String dpidsha1) {
		this.dpidsha1 = dpidsha1;
	}

	public String getMacsha1() {
		return macsha1;
	}

	public void setMacsha1(String macsha1) {
		this.macsha1 = macsha1;
	}

	public String getImeimd5() {
		return imeimd5;
	}

	public void setImeimd5(String imeimd5) {
		this.imeimd5 = imeimd5;
	}

	public String getDpidmd5() {
		return dpidmd5;
	}

	public void setDpidmd5(String dpidmd5) {
		this.dpidmd5 = dpidmd5;
	}

	public String getMacmd5() {
		return macmd5;
	}

	public void setMacmd5(String macmd5) {
		this.macmd5 = macmd5;
	}

	public String getOpenUdid() {
		return openUdid;
	}

	public void setOpenUdid(String openUdid) {
		this.openUdid = openUdid;
	}

	public String getCustomId() {
		return customId;
	}

	public void setCustomId(String customId) {
		this.customId = customId;
	}

	public String getVisitorId() {
		return visitorId;
	}

	public void setVisitorId(String visitorId) {
		this.visitorId = visitorId;
	}

	public int getMuniqueType() {
		return muniqueType;
	}

	public void setMuniqueType(int muniqueType) {
		this.muniqueType = muniqueType;
	}

	public String getMuniqueId() {
		return muniqueId;
	}

	public void setMuniqueId(String muniqueId) {
		this.muniqueId = muniqueId;
	}

	public int getMobOps() {
		return mobOps;
	}

	public void setMobOps(int mobOps) {
		this.mobOps = mobOps;
	}

	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public String getModal() {
		return modal;
	}

	public void setModal(String modal) {
		this.modal = modal;
	}

	public int getOs() {
		return os;
	}

	public void setOs(int os) {
		this.os = os;
	}

	public String getOsVersion() {
		return osVersion;
	}

	public void setOsVersion(String osVersion) {
		this.osVersion = osVersion;
	}

	public int getJsEnable() {
		return jsEnable;
	}

	public void setJsEnable(int jsEnable) {
		this.jsEnable = jsEnable;
	}

	public int getConnType() {
		return connType;
	}

	public void setConnType(int connType) {
		this.connType = connType;
	}

	public int getDeviceType() {
		return deviceType;
	}

	public void setDeviceType(int deviceType) {
		this.deviceType = deviceType;
	}

	public float getScreenDensity() {
		return screenDensity;
	}

	public void setScreenDensity(float screenDensity) {
		this.screenDensity = screenDensity;
	}

	public int getScreenWidth() {
		return screenWidth;
	}

	public void setScreenWidth(int screenWidth) {
		this.screenWidth = screenWidth;
	}

	public int getScreenHeight() {
		return screenHeight;
	}

	public void setScreenHeight(int screenHeight) {
		this.screenHeight = screenHeight;
	}

	public int getScreenOritent() {
		return screenOritent;
	}

	public void setScreenOritent(int screenOritent) {
		this.screenOritent = screenOritent;
	}

	public float getLatitude() {
		return latitude;
	}

	public void setLatitude(float latitude) {
		this.latitude = latitude;
	}

	public float getLongitude() {
		return longitude;
	}

	public void setLongitude(float longitude) {
		this.longitude = longitude;
	}

	public int getCountryId() {
		return countryId;
	}

	public void setCountryId(int countryId) {
		this.countryId = countryId;
	}

	public int getStateId() {
		return stateId;
	}

	public void setStateId(int stateId) {
		this.stateId = stateId;
	}

	public int getCityId() {
		return cityId;
	}

	public void setCityId(int cityId) {
		this.cityId = cityId;
	}

	public int getDistrictId() {
		return districtId;
	}

	public void setDistrictId(int districtId) {
		this.districtId = districtId;
	}

	public String getBrowser() {
		return browser;
	}

	public void setBrowser(String browser) {
		this.browser = browser;
	}

	public String getTopRefUrl() {
		return topRefUrl;
	}

	public void setTopRefUrl(String topRefUrl) {
		this.topRefUrl = topRefUrl;
	}

	public String getRefUrl() {
		return refUrl;
	}

	public void setRefUrl(String refUrl) {
		this.refUrl = refUrl;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}

	public int getAgeLow() {
		return ageLow;
	}

	public void setAgeLow(int ageLow) {
		this.ageLow = ageLow;
	}

	public int getAgeHigh() {
		return ageHigh;
	}

	public void setAgeHigh(int ageHigh) {
		this.ageHigh = ageHigh;
	}

	public String getInteresting() {
		return interesting;
	}

	public void setInteresting(String interesting) {
		this.interesting = interesting;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getImpId() {
		return impId;
	}

	public void setImpId(String impId) {
		this.impId = impId;
	}

	public int getCampaignId() {
		return campaignId;
	}

	public void setCampaignId(int campaignId) {
		this.campaignId = campaignId;
	}

	public long getStrategyId() {
		return strategyId;
	}

	public void setStrategyId(long strategyId) {
		this.strategyId = strategyId;
	}

	public long getCreativeId() {
		return creativeId;
	}

	public void setCreativeId(long creativeId) {
		this.creativeId = creativeId;
	}

	public int getTemplateId() {
		return templateId;
	}

	public void setTemplateId(int templateId) {
		this.templateId = templateId;
	}

	public long getMaterialId() {
		return materialId;
	}

	public void setMaterialId(long materialId) {
		this.materialId = materialId;
	}

	public double getBidPrice() {
		return bidPrice;
	}

	public void setBidPrice(double bidPrice) {
		this.bidPrice = bidPrice;
	}

	public String getBidPriceType() {
		return bidPriceType;
	}

	public void setBidPriceType(String bidPriceType) {
		this.bidPriceType = bidPriceType;
	}

	public String getStrategies() {
		return strategies;
	}

	public void setStrategies(String strategies) {
		this.strategies = strategies;
	}

	public int getFlag() {
		return flag;
	}

	public void setFlag(int flag) {
		this.flag = flag;
	}

	public int getCreativeSpec() {
		return creativeSpec;
	}

	public void setCreativeSpec(int creativeSpec) {
		this.creativeSpec = creativeSpec;
	}

	/**
	 * @return the channel
	 */
	public String getChannel() {
		return channel;
	}

	/**
	 * @param channel
	 *            the channel to set
	 */
	public void setChannel(String channel) {
		this.channel = channel;
	}

	public int getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(int areaCode) {
		this.areaCode = areaCode;
	}

	public Object clone() {
		BidContext context = null;

		try {
			context = (BidContext) super.clone();
		} catch (CloneNotSupportedException e) {

		}

		return context;

	}

	@Override
	public String toString() {
		return JsonUtils.toJson(this);
	}

}
